package com.nt.thah.controller;

import com.nt.thah.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description: 登录注册模块
 * @author: ls
 * @Date: 2020/7/8 16:12
 */
@Api(tags = "登录注册模块")
@RestController
@RequestMapping("/login")
@Validated
public class LoginController {

    @Resource
    private LoginService loginServiceImpl;

    @ApiOperation(value = "后台登录")
    @PostMapping("/signIn")
    public String signIn(String account, String password, HttpServletResponse response) {
        Assert.hasText(account, "账号不能为空");
        Assert.hasText(password, "密码不能为空");
        return loginServiceImpl.signIn(account, password, response);
    }

}
